﻿<UserControl x:Class="TimeSplicerModule.Views.CategoryView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300"
             Width="900" Height="600">
    
    <!-- Need to split this into two Colums -->
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="450" />
            <ColumnDefinition Width="450" />
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        
        <Grid Grid.Column="0" Grid.Row="0" VerticalAlignment="Top" HorizontalAlignment="Left">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="150" />
                <ColumnDefinition Width="225" />
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition />
                <RowDefinition />
                <RowDefinition />
                <RowDefinition />
                <RowDefinition />
                <RowDefinition />
                <RowDefinition />
                <RowDefinition />
                <RowDefinition />
                <RowDefinition Height="75" />
            </Grid.RowDefinitions>

            <!-- Name -->
            <Border Grid.Column="0" Grid.Row="0" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="5">
                <TextBlock Text="Name:" />
            </Border>

            <Border Grid.Column="1" Grid.Row="0" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="5">
                <TextBox Text="{Binding Path=Name, Mode=TwoWay}"  Width="200"/>
            </Border>

            <!-- Description -->
            <Border Grid.Column="0" Grid.Row="1" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="5">
                <TextBlock Text="Description:" />
            </Border>

            <Border Grid.Column="1" Grid.Row="1" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="5">
                <TextBox Text="{Binding Path=Description, Mode=TwoWay}" Width="200" />
            </Border>


            <!-- Is Project Category  -->
            <Border Grid.Column="0" Grid.Row="2" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="5">
                <TextBlock Text="Is Project Category:" />
            </Border>

            <Border Grid.Column="1" Grid.Row="2" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="5">
                <CheckBox IsChecked="{Binding Path=IsProjectCategory, Mode=TwoWay}" />
            </Border>

            <!-- Is Branch Category  -->
            <Border Grid.Column="0" Grid.Row="3" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="5">
                <TextBlock Text="Is Branch Category:" />
            </Border>

            <Border Grid.Column="1" Grid.Row="3" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="5">
                <CheckBox IsChecked="{Binding Path=IsBranchCategory, Mode=TwoWay}" />
            </Border>

            <!-- Is Task Category -->
            <Border Grid.Column="0" Grid.Row="4" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="5">
                <TextBlock Text="Is Task Category:" />
            </Border>

            <Border Grid.Column="1" Grid.Row="4" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="5">
                <CheckBox IsChecked="{Binding Path=IsTaskCategory, Mode=TwoWay}" />
            </Border>

            
            <!-- Is Task Sub Category -->
            <Border Grid.Column="0" Grid.Row="5" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="5">
                <TextBlock Text="Is Task Sub Category:" />
            </Border>

            <Border Grid.Column="1" Grid.Row="5" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="5">
                <CheckBox IsChecked="{Binding Path=IsTaskSubCategory, Mode=TwoWay}" />
            </Border>

            <!-- Parent Category -->
            <Border Grid.Column="0" Grid.Row="6" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="5" Visibility="{Binding Path=ParentCategoriesVisibility}">
                <TextBlock Text="Parent Category:" />
            </Border>

            <Border Grid.Column="1" Grid.Row="6" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="5" Visibility="{Binding Path=ParentCategoriesVisibility}">
                <ComboBox Name="categoryComboBox" ItemsSource="{Binding Path=Categories}" Width="200" Height="25" 
                                      DisplayMemberPath="Name"
                                      SelectedValuePath="CategoryGuid"
                                      SelectedValue="{Binding Path=ParentCategoryGuid, UpdateSourceTrigger=PropertyChanged}">
                </ComboBox>
            </Border>


            <!-- Is global -->
            <Border Grid.Column="0" Grid.Row="7" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="5" Visibility="{Binding Path=IsGlobalVisibility}">
                <TextBlock Text="Is Global:" />
            </Border>

            <Border Grid.Column="1" Grid.Row="7" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="5" Visibility="{Binding Path=IsGlobalVisibility}">
                <CheckBox IsChecked="{Binding Path=IsGlobal, Mode=TwoWay}" />
            </Border>

            <!-- Is Active -->
            <Border Grid.Column="0" Grid.Row="8" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="5">
                <TextBlock Text="Is Active:" />
            </Border>

            <Border Grid.Column="1" Grid.Row="8" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="5">
                <CheckBox IsChecked="{Binding Path=IsActive, Mode=TwoWay}" />
            </Border>



            <Border Grid.Column="0" Grid.Row="9" Grid.ColumnSpan="2" VerticalAlignment="Center" HorizontalAlignment="Center">
                <StackPanel Orientation="Horizontal">
                    <Button Name="saveButton" Content="Save" Width="100" Height="25" Click="saveButton_Click" />
                    <Button Name="saveExitButton" Content="Save &amp; Exit" Width="100" Height="25" Click="saveExitButton_Click"  Margin="15,0,0,0" />
                    <Button Name="cancelButton" Content="Cancel" Width="100" Height="25" Click="cancelButton_Click"  Margin="15,0,0,0" />
                </StackPanel>
            </Border>
        </Grid>
        
        <Grid Grid.Column="1" Grid.Row="0" VerticalAlignment="Top" HorizontalAlignment="Left">
            <Grid.ColumnDefinitions>
                <ColumnDefinition />
                <ColumnDefinition />
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition />
                <RowDefinition />
                <RowDefinition />
            </Grid.RowDefinitions>
            
            <!--  Teams -->
            <Border Grid.Column="0" Grid.Row="0" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="5">
                <TextBlock Text="Team:" />
            </Border>

            <Border Grid.Column="1" Grid.Row="0" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="5">
                <ComboBox Name="teamsComboBox" ItemsSource="{Binding Path=Teams}" Width="200" Height="25" 
                                      DisplayMemberPath="Name"
                                      SelectedValuePath="TeamGuid"
                                      SelectedValue="{Binding Path=SelectedTeamGuid, UpdateSourceTrigger=PropertyChanged}">
                </ComboBox>
            </Border>

            <!-- And Add Button -->
            <Border Grid.Column="0" Grid.Row="1" Grid.ColumnSpan="2" VerticalAlignment="Center" HorizontalAlignment="Center" Margin="5">
                <Button Name="addTeam" Content="Add To Team" Width="125" Height="25" Click="addTeam_Click" />
            </Border>
            
            <!-- Data List -->
            <Border Grid.Column="0" Grid.Row="2" Grid.ColumnSpan="2" VerticalAlignment="Top" HorizontalAlignment="Center" Margin="5">
                <DataGrid Name="teamCategoryGrid" ItemsSource="{Binding Path=ObservableTeamCategories}"
                      AutoGenerateColumns="False"
                      CanUserAddRows="False"
                      CanUserDeleteRows="False"
                      IsReadOnly="True"
                      Style="{StaticResource AzureDataGrid}">

                    <DataGrid.Columns>
                        <DataGridTextColumn Header="Team" Binding="{Binding Path=Team.Name}"/>
                    </DataGrid.Columns>
                </DataGrid>
            </Border>
        </Grid>
    </Grid>
</UserControl>
